package com.foreveredu.propms.service;

import java.util.List;

import org.springframework.security.core.userdetails.UserDetailsService;

import com.foreveredu.propms.domain.Building;
import com.foreveredu.propms.domain.BuildingType;
import com.foreveredu.propms.domain.Department;
import com.foreveredu.propms.domain.District;
import com.foreveredu.propms.domain.House;
import com.foreveredu.propms.domain.HouseSource;
import com.foreveredu.propms.domain.HouseType;
import com.foreveredu.propms.domain.Message;
import com.foreveredu.propms.domain.News;
import com.foreveredu.propms.domain.Owner;
import com.foreveredu.propms.domain.PageModel;
import com.foreveredu.propms.domain.Role;
import com.foreveredu.propms.domain.StrongNews;
import com.foreveredu.propms.domain.SubDistrict;
import com.foreveredu.propms.domain.User;

public interface IManagementService extends UserDetailsService {

	/*
	 * Role对象的事务处理
	 */
	void saveRole(Role role);
	
	void deleteRoleById(int id);
	
	void updateRole(Role role);
	
	List<Role> findRoles();
	
	Role findRoleById(int id);
	
	Role findRoleByName(String name);
	
	/*
	 * User对象的事务处理
	 */
	void saveUser(User user);
	
	void deleteUserById(int id);
	
	void updateUser(User user);
	
	List<User> findUsers();
	
	User findUserById(int id);
	
	User findUserByUsername(String username);
	
	List<User> findUsersByRoleName(String roleName);

	/*
	 * Department对象的事务处理
	 */
	void saveDepartment(Department department);
	
	void deleteDepartmentById(int id);
	
	void updateDepartment(Department department);
	
	List<Department> findDepartments();
	
	Department findDepartmentById(int id);
	
	Department findDepartmentByDeptId(String deptId);
	
	/*
	 * District对象的事务处理
	 */
	void saveDistrict(District district);
	
	void deleteDistrictById(int id);
	
	void updateDistrict(District district);
	
	List<District> findDistricts();
	
	District findDistrictById(int id);
	
	District findDistrictByDistrictId(String districtId);
	
	/*
	 * SubDistrict对象的事务处理
	 */
	void saveSubDistrict(SubDistrict subDistrict);
	
	void deleteSubDistrictById(int id);
	
	void updateSubDistrict(SubDistrict subDistrict);
	
	List<SubDistrict> findSubDistricts();
	
	List<SubDistrict> findSubDistrictsOfDistrict(District district);
	
	SubDistrict findSubDistrictById(int id);
	
	SubDistrict findSubDistrictBySubDistrictId(String subDistrictId);
	
	/*
	 * Building楼栋对象的事务处理
	 */
	void saveBuilding(Building building);
	
	void deleteBuildingById(int id);
	
	void updateBuilding(Building building);
	
	List<Building> findBuildings();
	
	Building findBuildingById(int id);
	
	Building findBuildingByBuildingId(String buildingId);
	
	/*
	 * 分页显示楼栋
	 * @param districtId
	 * 0代表搜索所有物业服务处的楼栋
	 * 否则，不为0代表搜索当前物业服务处的楼栋
	 */
	PageModel findBuildingList(int offset, int districtId);	

	/*
	 * BuildingType楼栋类型对象的事务处理
	 */
	void saveBuildingType(BuildingType type);
	
	void deleteBuildingTypeById(int id);
	
	void updateBuildingType(BuildingType type);
	
	List<BuildingType> findBuildingTypes();
	
	BuildingType findBuildingTypeById(int id);
	
	/*
	 * House房产对象的事务处理
	 */
	void saveHouse(House house);
	
	void deleteHouseById(int id);
	
	void updateHouse(House house);
	
	List<House> findHouses();
	
	House findHouseById(int id);
	
	House findHouseByHouseId(String houseId);
	
	//分页查询房产，districtId为0，代表显示所有房产，否则，代表某物业服务处下的所有房产
	PageModel findHouseList(int offset, int districtId);
	
	//根据小区查找该小区的所有房产编号
	List<House> findHousesBySubId(SubDistrict subDistrict);
	
	//房产登记相关操作

	/*
	 * HouseType房产类型对象的事务处理
	 */
	void saveHouseType(HouseType houseType);
	
	void deleteHouseTypeById(int id);
	
	void updateHouseType(HouseType houseType);
	
	List<HouseType> findHouseTypes();
	
	HouseType findHouseTypeById(int id);
	

	/*
	 * HouseSource房产来源对象的事务处理
	 */
	void saveHouseSource(HouseSource houseSource);
	
	void deleteHouseSourceById(int id);
	
	void updateHouseSource(HouseSource houseSource);
	
	List<HouseSource> findHouseSources();
	
	HouseSource findHouseSourceById(int id);
	
	House findhouseByOwner(Owner owner);
	
	
	/*
	 * Owner业主对象的事务处理
	 */
	void saveOwner(Owner owner);
	
	void deleteOwnerById(int id);
	
	void updateOwner(Owner owner);
	
	List<Owner> findOwners();
	
	Owner findOwnerById(int id);
	
	Owner findOwnerByOwnerId(String ownerId);

	PageModel findOwnerList(int offset);

	Owner findOwnerByIdCard(String idCard);
	
	//通过业主姓名查找业主
	Owner findOwnerByName(String ownerName);

	//通过业主电话查找业主
	Owner findOwnerByPhone(String phone);
	//通过房产编号和业主身份证查询业主
	Owner findOwnerByHouseIdAndIdCard(String houseId, String idCard);
	
	Owner findOwnerByHouseIdAndPassword(String houseId, String password);
	
	/*
	 * News对象的事务处理
	 */
	List<News> findNewsListView(int belong);

	void saveNews(News news);

	PageModel findNewsList(int offset ,int belong);

	News findNewsById(int id);

	void updateNewsStateById(News news);

	News findNewsByState();

	void deleteNewsById(int id);

	void updateNews(News news);
	
	News findNewsByBelong(int belong);
	
	/*
	 * StrongNews对象的事务处理
	 */
	List<StrongNews> findStrongNewsListView(int belong);

	void saveStrongNews(StrongNews strongNews);

	PageModel findStrongNewsList(int offset ,int belong);

	StrongNews findStrongNewsById(int id);

	void updateStrongNewsStateById(StrongNews strongNews);

	StrongNews findStrongNewsByState();

	void deleteStrongNewsById(int id);

	void updateStrongNews(StrongNews strongNews);
	
	StrongNews findStrongNewsByBelong(int belong);
	
	/*
	 * Message对象的事务处理
	 */
	void saveMessage(Message message);
	
	Message findMessageById(int id);
	
	void updateMessage(Message message);
	
	void deleteMessage(Message message);

	List<Message> findMessageListForTen();

	PageModel findMessageList(int offset);

	PageModel findOwnerListByDistrict(int offset, int districtId);

	PageModel findOwnerListBySubDistrict(int offset, int subDistrict_id);

	//列出小区中的所有房产信息
	List<House> findAllHousesBySubDistrict(SubDistrict subDistrict);

	List<Building> findBuildingsBySubDistrict(int id);

	

	

	

}
